package yzy.ecps.dao.impl;

import java.util.List;

import org.mybatis.spring.support.SqlSessionDaoSupport;
import org.springframework.stereotype.Repository;

import yzy.ecps.dao.BrandDao;
import yzy.ecps.model.BtcBrand;

@Repository
public class BrandDaoImpl extends SqlSessionDaoSupport implements BrandDao {
	
	//配置文件名称空间
	String ns = "btc_brand.";
	
	public List<BtcBrand> findAll() {
		return getSqlSession().selectList(ns+"findAll");
	}

	public void saveBrand(BtcBrand brand) {
		getSqlSession().insert(ns+"insert", brand);
	}

	public BtcBrand getById(Long brandId) {
		return getSqlSession().selectOne(ns+"selectByPrimaryKey",brandId);
	}

	public void updateOne(BtcBrand brand) {
		getSqlSession().update(ns+"updateByPrimaryKeySelective", brand);
	}

	public void deleteById(Long brandId) {
		getSqlSession().delete(ns+"deleteByPrimaryKey", brandId);
	}

	public List<BtcBrand> findByName(String brandName) {
		return getSqlSession().selectList(ns+"findByName", brandName);
	}

}
